﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using log4net;

namespace RollBack.src.ui
{
    public partial class ExceptionMessageForm : Form
    {
        private static readonly ILog log = LogManager.GetLogger(typeof(ExceptionMessageForm));
        public ExceptionMessageForm()
        {
            InitializeComponent();
            // remember the size of the stack trace box
            m_stackTraceTextBoxSize = m_stackTraceTextBox.Size;
            toggleStackTraceBoxSize();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            toggleStackTraceBoxSize();
        }

        private void toggleStackTraceBoxSize()
        {
            if (m_stackTraceTextBox.Size.Height > 10)
            {
                m_stackTraceControlButton.Text = "&More  >>>";
                m_stackTraceTextBox.Size = new Size(m_stackTraceTextBox.Size.Width, 1);
                this.Size  = new System.Drawing.Size(this.Size.Width, this.Size.Height - (m_stackTraceTextBoxSize.Height-5));
            }
            else
            {
                m_stackTraceControlButton.Text = "&Less  <<<";
                m_stackTraceTextBox.Size = new Size(m_stackTraceTextBox.Size.Width, m_stackTraceTextBoxSize.Height);
                this.Size = new System.Drawing.Size(this.Size.Width, this.Size.Height + (m_stackTraceTextBoxSize.Height - 5));
            }
        }
    }
}
